#include <iostream>
#include <Windows.h>
#include "runner_impl.hpp"

class Timer 
{
public:
	void Start()
	{
		DWORD_PTR oldmask = ::SetThreadAffinityMask(::GetCurrentThread(), 0);
		::QueryPerformanceCounter(&start);
		::SetThreadAffinityMask(::GetCurrentThread(), oldmask);
	}

	void Stop(void)
	{
		DWORD_PTR oldmask = ::SetThreadAffinityMask(::GetCurrentThread(), 0);
		::QueryPerformanceCounter(&stop);
		::SetThreadAffinityMask(::GetCurrentThread(), oldmask);
	}

	double ElapsedMilliseconds()
	{
		return static_cast<double>(stop.QuadPart - start.QuadPart) / GetFrequency();
	}

private:
	LONGLONG GetFrequency()
	{
		LARGE_INTEGER proc_freq;
		QueryPerformanceFrequency(&proc_freq);
		return proc_freq.QuadPart;
	}

	LARGE_INTEGER start;
	LARGE_INTEGER stop;
};




int main()
{
	const int SIZE = 100000000;
	//RunnerImpl runner;
	Timer timer;

	timer.Start();
	//auto result = runner.Run(SIZE, Cancel);
	timer.Stop();

	//std::cout << "Result = " << result << " in " << timer.ElapsedMilliseconds() << "\n";
	system("pause");
}
